package pres.moling.common.tool;

/**
 * @author yhmoling
 * 2023/9/22
 */
public interface ArrayHelper {

    static int[] range(int n) {
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = i;
        }
        return arr;
    }

    static int[] range(int start, int end) {
        int size = end - start;
        int[] arr = new int[size];
        for (int i = 0; i < size; i++) {
            arr[i] = start + i;
        }

        return arr;
    }

    static int[] range(int start, int end, int step) {
        int size = (end - start) / step;
        int[] arr = new int[size];
        for (int i = 0; i < size; i++) {
            arr[i] = start + (i * step);
        }
        return arr;
    }
}
